import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

let routesMb = [
    {path: '/', name: 'home', component: () => import(/* webpackChunkName: "about" */ '../views/home/index.vue')},
    {path: '/question', name: 'question', component: () => import(/* webpackChunkName: "about" */ '../views/question/index.vue')},
    {path: '/success', name: 'success', component: () => import(/* webpackChunkName: "about" */ '../views/question/success.vue')},
    {path: '/error', name: 'error', component: () => import(/* webpackChunkName: "about" */ '../views/question/error.vue')},
    {path: '/record', name: 'record', component: () => import(/* webpackChunkName: "about" */ '../views/question/record.vue')},
    {path: '/pc', name: 'home', component: () => import(/* webpackChunkName: "about" */ '../views/pc/index.vue')}
]

let routesPc=[
    // {path: '/', name: 'home', component: () => import(/* webpackChunkName: "about" */ '../page/index.vue')}

]

var routes=[]
if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
    routes = routesMb
} else {
    routes = routesMb
}



const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes,
    scrollBehavior: () => ({ y: 0 }),//每次都跳转到顶部
})
export default router
